package cn.itsource.basic.util;

import cn.itsource.App;
import cn.itsource.user.domain.LoginInfo;
import org.springframework.data.redis.core.RedisTemplate;

import javax.servlet.http.HttpServletRequest;

/**
 * 获取登录用户信息
 */
public class SystemLoginInfo {
    public static LoginInfo get(HttpServletRequest request){
        //获取token
        String token = request.getHeader("token");
        RedisTemplate redisTemplate = App.getRedisTemplate();
        return (LoginInfo)redisTemplate.opsForValue().get(token);
    }
}
